package com.example.demo.service;

import com.example.demo.entity.Userinfo;
import com.example.demo.entity.Remark;
import com.example.demo.entity.Videoinfo;
import com.example.demo.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

@Service
public class UserService implements Serializable {
    @Resource
    public UserMapper userMapper;
    //注册
    public int reg(Userinfo userinfo){
        return userMapper.reg(userinfo);
    }

    //登录
    public Userinfo getUserByName(String username){
        return userMapper.getUserByName(username);
    }

    //根据id获取用户信息
    public Userinfo getUserById(Integer id){
        return userMapper.getUserById(id);
    }

    //修改个人信息
    public int regupdate(Userinfo userinfo){
        return userMapper.regupdate(userinfo);
    }

    //查询所有人的评论
    public List<Remark> getRemarkAll(Integer id){
        return userMapper.getremarkall(id);
    }

    //添加评论
    public int remarkadd(Remark remark){
        return userMapper.remarkadd(remark);
    }

    //存储图片相信到数据库
    public int videoadd(Videoinfo videoinfo){
        return userMapper.videoadd(videoinfo);
    }

    //获取数据库中的图片相信
    public Videoinfo getimg(Integer id){
        return userMapper.getimg(id);
    }
}
